package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"user_srv/userclient"
)

type ServiceContext struct {
	Config            config.Config
	AuthTokenTemplate rest.Middleware
	UserSrv           userclient.User
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:            c,
		AuthTokenTemplate: middleware.NewAuthTokenTemplateMiddleware().Handle,
		UserSrv:           userclient.NewUser(zrpc.MustNewClient(c.UserSrv)),
	}
}
